/*
 * @Author: aggfb 714740235@qq.com
 * @Date: 2025-01-06 15:20:55
 * @LastEditors: aggfb 714740235@qq.com
 * @LastEditTime: 2025-07-12 19:04:49
 * @FilePath: \wire_receiver_main\app\task_scan.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "task_manager.h"
#include "com_scan.h"

void task_rx_scan(void *pvParameters)
{
    bsp_uart_driver_t* drv = scan_drv();

    xTaskCreate(task_tx_scan, \
                "tx_scan", \
                TASK_SCAN_TX_STK_SIZE, \
                NULL, \
                TASK_SCAN_TX_PRIO, \
                NULL);

    while(1)
    {
        /* 阻塞读取 scan 数据 */
        uint8_t byte = 0;
        drv->ops.read(drv, &byte, 1);

        /* 按字节解析数据 */
        scan_receive_analysis(byte);
    }
}   
static struct _protocol pack;
void task_tx_scan(void *pvParameters)
{
    bsp_uart_driver_t* drv = scan_drv();

    while(1)
    {
        xQueueReceive(drv->port.tx_queue, &pack, portMAX_DELAY);
        drv->ops.write(drv, (uint8_t*)&pack.buff, pack.size);
    }
}   

